var express = require('express');
var router = express.Router();
const superagent = require('superagent');
const cheerio = require('cheerio')

/* GET home page. */
router.get('/pachong', function (req, res, next) {
  //抓取
  superagent.get(req.query.url).end(function (err, result) {
    if (err) {
      res.send('抓取失败')
    } else {
      //对抓到的数据进行进一步处理
      const $ = cheerio.load(result.text);


      res.send($('.muye-reader-content>div').html())
    }
  })
  // res.send(req.query.url);
});

module.exports = router;
